Functions | User defined functions |
These Predefined functions can be used within an Assign command:
Abs returns the absolute value of a numeric argument.
e.g. @assign Num = ABS(Var) with Var equal to -22.1 puts the value 22.1 into Num.
ArcTan returns the arc tangent of a numeric argument.
e.g. @assign Num = ARCTAN(Var) The result in Num is the principal value, in radians, of the arc tangent of Var.
Copy returns the sub-string from Str1 starting at Var1 for length Var2.
e.g. @assign Str = Copy (Str1,Var1,Var2)
Cos returns the cosine of a numeric argument.
e.g. @assign Num = COS(Var)
Date returns the number of days (as of today's date) since 1st January 1900 for Windows (XrServer) deployments and 1st January 1970 for JavaScript Engine Deployments
EncodeDate returns the date in the format of the country setting being used. Note that the order of the variables supplied or received must use the English date format of Day, Month, Year. For example, on a computer with a date setting for MM/DD/YYYY, this EncodeDate function…
@Assign Date_var = EncodeDate ( 31, 12, 1999 )
would result in 12/31/1999 in Date_var.
Exp returns the exponential of a numeric argument.
e.g. @assign Num = EXP(Var)
Frac returns the fractional part of a numeric argument.
e.g. @assign Num = FRAC(Var) with Var equal to 87.45 would put the value .45 into Num.
GetDays(MyDateObject) returns the number of days since 1st January 1970 for a given date object (with negative values for pre-1970 dates) for JavaScript Engine Deployment only. For example, to use this function to calculate the approximate age in years from a given date of birth:
@Assign Age = int((Date - GetDays(Date_of_Birth)) / 365.25)
Int returns the integer part of a numeric argument.
e.g. @assign Num = INT(Var) with Var equal to 87.45 puts the value 87 into Num.
Length returns the number of characters in the string Str.
e.g. @assign Num = Length(Str)
Ln returns the natural logarithm of a numeric argument.
e.g. @assign Num = LN(Var)
Pi returns the value of Pi (3.1415926535897932385)
e.g. @assign Num = Pi
RGB returns the numeric code for the color mix red/green/blue; the following examples all set the color to be yellow …
@Assign Dialog1.Color = RGB(255,255,0)
@Assign Dialog1.Color = RGB(0xFF,0xFF,0x0)
@Assign Dialog1.Color = 65535
@Assign Dialog1.Color = 0x00FFFF
(0x is used to denote hexadecimal numbers)
Rnd returns a random number between 0 and N.
The RandSeed command can be used to seed the random number generator.
e.g. @assign Num = RND(N)
Round returns the nearest integer number of a numeric argument.
e.g. @assign Num = ROUND(N) would assign 6 to Num if N was 6.1 or 5.8
Sin returns the sine of a numeric argument.
e.g. @assign Num = SIN(Var)
Sqr returns the square of a numeric argument.
e.g. @assign Num = SQR(Var)
Sqrt returns the square root of a numeric argument.
e.g. @assign Num = SQRT(Var)
See also how to use Operators in the assign command.